package com.treasure.mall.biz.remote.track.dto.kd100;

import com.treasure.mall.biz.remote.track.dto.TrackInfoDTO;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/6/9
 */
@Data
public class KD100QueryResp implements Serializable {
    private static final long serialVersionUID = 6646166021953443714L;

    private String message;
    private List<Content> data;

    static class Content {
        private String context;
        private String time;

        public String getContext() {
            return context;
        }

        public void setContext(String context) {
            this.context = context;
        }

        public String getTime() {
            return time;
        }

        public void setTime(String time) {
            this.time = time;
        }

        public TrackInfoDTO toTrackInfo() {
            TrackInfoDTO trackInfoDTO = new TrackInfoDTO();
            trackInfoDTO.setContext(this.context);
            trackInfoDTO.setTime(this.time);
            return trackInfoDTO;
        }
    }

    public List<TrackInfoDTO> toTrackInfo() {
        List<TrackInfoDTO> trackInfoDTOS = new ArrayList<>();
        data.forEach(p -> trackInfoDTOS.add(p.toTrackInfo()));
        return trackInfoDTOS;
    }
}

